function register() {
    var user = $('input[name="username"]').val();
    var pwd = $('input[name="password"]').val();

    if (user == '' || pwd == '') {
        $(".tips").removeClass("dis");
        $(".tips").addClass("layui-anim");
        $(".tips").addClass("layui-anim-upbit");

        return false;
    } else {
        $(".tips").addClass("dis");

    }

    $.ajax({
        url: '/postregister',
        method: "post",
        data: {userName: user, password: pwd},
        dataType: 'json',

        success: function (data) {

            if (data.code == 0) {

                layer.msg(data.msg);


                setTimeout(function () {
                    window.location.href = '/';
                }, 1000);
            }
            if (data.code == -1) {
                layer.msg(data.msg);

                // setTimeout(function () {
                //     window.location.href = '/';
                // }, 1000);

            }
        }
    })

}